<template>
  <div>
    <danger-detail-info :form="form"></danger-detail-info>
  </div>
</template>
<script>
import store from "@/store/index";
import dangerDetailInfo from './dangerDetailInfo.vue';
export default {
  components: { dangerDetailInfo },
  data() {
    return {
      id: this.$route.query.id,
      type: this.$route.query.type,
      form: {},
    };
  },
  created() {
    this.geDetail();
    this.calcTitle();
  },
  methods: {
    // 获取详情
    geDetail() {
      let _this = this;
      _this.$axios
      .get("/DangerCheckTaskDetailJG/GetDetail",{params:{ id: this.id }})
      .then((res)=>{
        _this.form = res.data;
      })
    },
    calcTitle() {
      if (this.type == "submited") {
        store.commit("updateTitle", "已提交隐患详情");
      } else if (this.type == "confirmed") {
        store.commit("updateTitle", "已确认隐患详情");
      } else if (this.type == "assigned") {
        store.commit("updateTitle", "已指派隐患详情");
      } else if (this.type == "formulated") {
        store.commit("updateTitle", "已制定措施隐患详情");
      } else if (this.type == "correctived") {
        store.commit("updateTitle", "已整改隐患详情");
      } else if (this.type == "verified") {
        store.commit("updateTitle", "验收通过隐患详情");
      } else {
        if (this.form.CheckResult == "N") {
          store.commit("updateTitle", "隐患详情");
        } else {
          store.commit("updateTitle", "检查记录详情");
        }
      }
    },
  },
};
</script>
